<?php
/*
 * Created on 06.01.2006
 *
 */

/**
 * Out tag for cms texts edited with the wysiwyg editor
 */
class cms_outHandler 
{

    function startElement (& $sender, $attrs)
    {
        if (!$attrs['value'])
        {
            die ("Attribute value is missing in out tag\n");
        }
        if ($attrs['escape'])
        {
            if ($attrs['escape'] == "'all'")
            {
                $attrs['value'] = 'htmlentities('.$attrs['value'].')';
            }
            if ($attrs['escape'] == "'special'")
            {
                $attrs['value'] = 'htmlspecialchars('.$attrs['value'].')';
            }
        }
        $sender->appendCode('print $GLOBALS[\'tpl\']->parseText('.$attrs['value'].');'."\n");
    }
    
    function endElement (& $sender)
    {
    
    }

}

?>